<template>
  <div i="team">
    <team-card-list :team-list="teamList"></team-card-list>
    <van-empty v-if="!teamList || teamList.length < 1" description="数据为空" />
  </div>
</template>

<script setup lang="ts">
import {useRouter} from "vue-router";
import TeamCardList from "../components/TeamCardList.vue";
import {onMounted, ref} from "vue";
import {showToast} from "vant";
import myAxios from "../plugins/MyAxios.ts";

//搜索
const value = ref('');
const onSearch = (val) => {
  listTeam(val);
}

const listTeam = async (val = '') => {
  const res = await myAxios.get("/team/list/my", {
    params: {
      searchText: val,
      pageNum: 1,
    },
  });
  if(res?.code === 0) {
    teamList.value = res.data;
  } else {
    showToast("加载队伍失败，请重试")
  }
}


const onCancel = () => showToast('取消');

// 跳转页面对象
const router = useRouter()

// 跳转到加入队伍页
const doJoinTeam = () => {
  router.push({
    path: "/team/add"
  })
}

const teamList = ref([]);
// 页面加载时执行一次
onMounted( async () => {
  listTeam();
})



</script>

<style scoped>

</style>